def screenshot_function(dialog,projectID)

   #以下编写将场景截图，及将截图上传到oss服务器方法，参数为“projectId”
   require 'json'
     t = Time.now
     puts t
     puts "-------------------------------------------------------------------------"
       keys = {
       :width => 640,
       :height => 480,
       :antialias => true,
       :transparent => true
     }
     boundary = "----RubyMultipartClient#{rand(1000000)}ZZZZZ"
     mod = Sketchup.active_model # Open model
     pngs=File.join(Sketchup.find_support_file('Plugins'), 'pngs')
     dir=Dir.mkdir(pngs) unless File.exist?(pngs)
     keys[:filename]= "#{pngs}\\project#{projectID}.png"
     mod.active_view.write_image(keys)
    # status2 = mod.save_thumbnail "#{pngs}\\project#{projectID}#{t.min}#{t.sec}.png"
     png_file = "#{pngs}\\project#{projectID}.png"
     data = []
     data << "Content-Type: multipart/form-data; boundary=#{boundary}"
     data << "\r\n--#{boundary}\r\n"
   # name字段跟png，后面filename随意名字
     data << "Content-Disposition: form-data; name=\"png\"; filename=\"1.png\"\r\nContent-Type: application/octet-stream\r\n\r\n"
     File.open(png_file, "rb:BINARY") { |file|
      contents = file.read
      data << contents
     }
     data << "\r\n--#{boundary}--\r\n"
     data.each { |line|
      line.force_encoding(Encoding::BINARY)
     }
   payload = data.join
   headers = {}
   headers['Content-Type'] = "multipart/form-data; boundary=#{boundary}"
   headers
   # 这里修改locaohost和后面projectId
   url ="http://dev.solarpv.top/api/client/project/upload/append?projectId=#{projectID}"
   request = Sketchup::Http::Request.new(url, Sketchup::Http::POST)
   request.headers = headers
   request.body = payload
   request.start do |req, res|
      # 继续处理
      #p res
      #p res.status_code
       #puts res.body
       json1=JSON.parse(res.body)
       screen_status=json1['status']
       screen_url=json1['data']['url']
       screen_object=json1['data']['object']
       p screen_status
       p  "--------------"
       p screen_url
       p  "--------------"
       p screen_object
       dialog.execute_script("screenshotStats(#{screen_status},'#{screen_url}','#{screen_object}')")
   end



end